package com.cy.dao;

import com.cy.domain.Goods;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;


import java.util.ArrayList;
import java.util.List;

@Repository
public class GoodsDao implements IGoodsDao{
    private ArrayList<Goods> list = new ArrayList<>();

    @Autowired
    private SqlSessionFactory sqlSession;


    @Override
    public List<Goods> findObjects() {
        SqlSession session = sqlSession.openSession();

        String statement = "com.cy.dao.IGoodsDao.findObjects";

        List<Goods> list = session.selectList(statement);
        session.close();

        return list;
    }
}
